package com.cn.wanxi.dao.impl;

import com.cn.wanxi.dao.ClothingTypeDao;
import com.cn.wanxi.model.ClothingTypeModel;
import com.cn.wanxi.model.CuisineModel;
import com.cn.wanxi.util.JDBC;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class ClothingTypeImpl implements ClothingTypeDao {
    @Override
    public List<ClothingTypeModel> findAll(ClothingTypeModel clothingTypeModel) {
        String sql = "select * from clothing_type where is_show=1";
        ResultSet resultset = JDBC.query(sql);
        List<ClothingTypeModel> list = new ArrayList<>();
        try {
            while (resultset.next()) {
                ClothingTypeModel clothingTypeModel1 = new ClothingTypeModel();
                clothingTypeModel1.setId(resultset.getInt("id"));
                clothingTypeModel1.setName(resultset.getString("name"));
                clothingTypeModel1.setTitle(resultset.getString("name"));
                clothingTypeModel1.setSort(resultset.getString("sort"));
                list.add(clothingTypeModel1);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }

        return list;
    }

    @Override
    public int add(ClothingTypeModel clothingTypeModel) {
        return 0;
    }

    @Override
    public int update(ClothingTypeModel clothingTypeModel) {
        return 0;
    }

    @Override
    public ClothingTypeModel findById(ClothingTypeModel clothingTypeModel) {
        return null;
    }

    @Override
    public int delete(ClothingTypeModel clothingTypeModel) {
        return 0;
    }

    @Override
    public int getCount(ClothingTypeModel clothingTypeModel) {
        return 0;
    }
}
